﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Luna.Framework.Manifest;

namespace Luna.Framework {
	
	public class MenuFormBuilder: IObjectBuilder {

		public string MenuName { get; set; }

		public IMenuRenderer MenuRenderer { get; set; }

		public void buildObject(object target, IAppContext context, object data) {
			if (target is Form) {
				Form form = target as Form;
				IManifest menu = Framework.Manifest.getManifest("menu", MenuName);
				if (menu != null && MenuRenderer != null) {
					MenuStrip menuControl = (MenuStrip)MenuRenderer.renderMenu(form.MainMenuStrip, menu, context);
				}
			}
		}
	}
}
